package org.zpmis.api.http;

import org.springframework.validation.annotation.Validated;
import org.zpmis.api.business.SysDictWebService;
import org.zpmis.common.base.BaseController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.zpmis.common.result.PlatformResult;
import org.zpmis.domain.dict.qo.DictListQo;

import javax.annotation.Resource;

/**
* created with CodeGenerator
* description: 业务字典操作接口
* @author  Yang
* date: 2021-5-31
* time: 13:57:41
*/
@RestController
@RequestMapping("/sys/dict")
@Slf4j
public class SysDictController extends BaseController{

    @Resource
    private SysDictWebService sysDictWebService;


    /**
     * 查询对应业务的字典表
     * @param dictListQo
     * @return
     */
    @PostMapping("/dictList")
    public PlatformResult dictList(@Validated @RequestBody DictListQo dictListQo){

        try {
            return PlatformResult.success(sysDictWebService.dictList(dictListQo));
        } catch (Exception e) {
            log.error("[SysDictController]---dictList--->Exception:",e);
            return PlatformResult.failure();
        }
    }
}
